package com.yan.demo;

public class MethodTest2 {
    public static int count = 0;
    public static void main(String[] args) {
        for (int i = 101; i < 201; i++) {
            judgePrime(i);
        }
        System.out.println();
        System.out.println("有" + count + "个素数");
    }

    public static void judgePrime(int n){
        boolean flag = true;
        for (int i = 2; i < n ; i++) {
            if(n % i == 0){
                flag = false;
                break;
            }
        }
        if(flag){
            System.out.print(n + " ");
            count++;
        }
    }
}
